<?php
namespace app\index\behavior;
/**
 * Created by Submint Text.
 * User: hetaoren<452649510@qq.com>
 * Date: 2017/03/10
 * Explain: 记录用户的访问日志
 */
class ListenOperate 
{
    public function run(&$params){
        $urls = HTRConf('listenUrl');
        $request = request();
        $visit = strtolower($request->module()."/".$request->controller()."/".$request->action());
        if(array_key_exists($visit,$urls) && $urls[$visit]['isParent']){
        	$data = [];
        	$data['menuId'] = $urls[$visit]['menuId'];
        	$data['operateUrl'] = $_SERVER['REQUEST_URI'];
        	$data['operateDesc'] = $urls[$visit]['name'];
        	$data['content'] = !empty($_REQUEST)?json_encode($_REQUEST):'';
        	$data['operateIP'] = $request->ip();
        	model('index/LogOperates')->add($data);
        }
    }
}